<template>
	<view>
		<navbar title="贷款预审详情" :autoBack="true"></navbar>
		<scroll-view scroll-y="true" class="scbox">
			<view class="con">
				<view class="con__box">
					<view class="con__box__title">
						审批详情
						<text class="con__box__time">提交时间:{{info.submit}}</text>
					</view>
					<view class="con__box__b">
						<view class="con__box__b__text">
							姓名: {{info.username}}
						</view>
						<view class="con__box__b__text">
							电话: {{info.mobile}}
						</view>
						<view class="con__box__b__text">
							销售: {{info.saleName}}
						</view>
						<view class="con__box__b__text">
							贷款额度需求: {{info.dedamount}}元
						</view>
						<view class="con__box__b__text">
							房产情况: {{info.house}}
						</view>
						<view class="con__box__b__text">
							车辆情况: {{info.car}}
						</view>
						<view class="con__box__b__text">
							工作单位: {{info.company}}
						</view>
						<view class="con__box__b__text">
							工作职位: {{info.role}}
						</view>
						<view class="con__box__b__text">
							月收入: {{info.salary}}
						</view>
						<view class="con__box__b__text">
							婚姻状况: {{info.marriage}}
						</view>
						<view class="con__box__b__text">
							社保: {{info.sb}}
						</view>
						<view class="con__box__b__text">
							公积金: {{info.gjj}}
						</view>
						<view class="con__box__b__text">
							负债情况: {{info.debt}}
						</view>
						<image src="/static/tool/spz.png" class="con__box__b__sp" mode=""></image>
					</view>
				</view>
			</view>
		</scroll-view>
		<view class="footer">
			<input type="number" class="footer__inp" v-model="loan_amount" placeholder="通过前先输入放款额度" />
			<view class="u-flex u-flex-xy-center">
				<u-button color="#3262FD" text='拒绝' :loading='loading' @click="submit(6)"
					:customStyle='{width:"304rpx",height:"87rpx",margin:"0 15rpx 0 0",padding:0,borderRadius:"5rpx",fontSize:"24rpx"}'></u-button>
				<u-button color="#D5D5D5" hairline plain text='通过' :loading='loading' @click="submit(2)"
					:customStyle='{width:"304rpx",height:"87rpx",margin:"0 0 0 15rpx",padding:0,borderRadius:"5rpx",fontSize:"24rpx",color:"#242424"}'></u-button>
				
			</view>
		</view>
	</view>
</template>

<script>
	import boos from '@/api/_boos.js'
	export default {
		data() {
			return {
				id:null,
				info:{},
				loan_amount:'',
				loading:false
			};
		},
		methods:{
			async getinfo(){
				let res = await boos.loanInfo({id:this.id})
				if(res.data.code==1){
					this.info=res.data.data
				}
			},
			async submit(status){
				if(status==2){//通过
					if(!this.loan_amount){
						uni.$u.toast('通过之前请先输入放款额度')
						return
					}
				}
				let _this=this
				this.loading=true
				let res = await boos.editLoan({status,loan_amount:this.loan_amount,id:this.id})
				if(res.data.code==1){
					uni.$u.toast('提交成功')
					setTimeout(()=>{
						_this.loading=false
						uni.navigateBack()
					},1000)
				}else{
					uni.$u.toast('提交失败')
					_this.loading=false
				}
			}
		},
		onLoad(o) {
			this.id=o.id
			this.getinfo()
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f8f8f8;
	}

	.con {
		padding: 20rpx 30rpx 300rpx;

		&__box {
			background: #FFFFFF;
			border-radius: 20rpx;
			padding: 13rpx 30rpx 54rpx;

			&__title {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 32rpx;
				color: #010101;
				line-height: 32rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 32rpx 6rpx 32rpx 9rpx;
			}

			&__time {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #6D6D6D;
				line-height: 24rpx;
			}

			&__b {
				background: #F4F5FA;
				border-radius: 20rpx;
				padding: 28rpx 25rpx 1rpx;
				position: relative;

				&__sp {
					width: 105rpx;
					height: 93rpx;
					position: absolute;
					right: 33rpx;
					top: 66rpx;
				}

				&__text {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 26rpx;
					color: #78797E;
					line-height: 26rpx;
					margin-bottom: 37rpx;
				}
			}
		}
	}

	.footer {
		width: 690rpx;
		height: 280rpx;
		background: #FFFFFF;
		padding: 0 30rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		&__inp {
			height: 108rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #333;
			line-height: 108rpx;
			border-bottom: 4rpx solid #ECE6E6;
			margin-bottom: 32rpx;

			::v-deep.uni-input-placeholder {
				font-size: 28rpx;
				color: #6D6D6D;
			}
		}
	}
</style>